package com.lvmama.rhino.entrance

import com.lvmama.rhino.analyze.client._
import com.lvmama.rhino.analyze.external.DataProvider
import com.lvmama.rhino.analyze.push.{PushCallbackJob, UserClickAnalysis}
import com.lvmama.rhino.common.utils.Utils

/**
  * @Description: 主入口
  * @Author: sunpengpeng
  * @Date: Create in 2018/6/26 10:07
  * @Modified By:
  */
object JobExecutor {
  def main(args: Array[String]) {
    val jobs: Option[String] => Unit = {

      //主job，数据处理与转换压缩，由日志文件转成parquet文件
      case Some("PreProcessWirelessStatJob") => PreProcessWireless(if (args.length >= 2) args(1) else Utils.getYesterday("yyyy/MM/dd"),
        if (args.length >= 3) args(2) else Utils.getYesterday("yyyy/MM/dd"))

      //用户操作路径清洗job
      case Some("WirelessOperPathStatJob") => WirelessOperPathStat(if (args.length >= 2) args(1) else Utils.getYesterday("yyyy/MM/dd"))
      //搜索跳转和搜索结果分析及产品详情统计
      case Some("WirelessStatVer2Batch") => WirelessStatVer2Batch(if (args.length >= 2) args(1) else Utils.getYesterday("yyyy/MM/dd"))
      //流量相关
      case Some("WirelessStatJob") => WirelessStat(if (args.length >= 2) args(1) else Utils.getYesterday("yyyy/MM/dd"))
      //专题坑位相关
      case Some("WirelessStatPitJob") => WirelessStatPit(if (args.length >= 2) args(1) else Utils.getYesterday("yyyy/MM/dd"))
      //超级自由行
      case Some("SuperFreeTravel") => SuperFreeTravel(if (args.length >= 2) args(1) else Utils.getYesterday("yyyy/MM/dd"))
      //临时job 修复数据
      case Some("VIPTempJob") => VIPTemp(if (args.length >= 2) args(1) else Utils.getYesterday("yyyy/MM/dd") + "-" + Utils.getYesterday("yyyy/MM/dd"))

      //数据提供 web页面，数据存缓存
      case Some("DataProvider") => DataProvider(args(1).toLong)
      //会员精准营销 有topic 存入topic
      case Some("VIPMarketingStreaming") => VIPMarketingStreaming(args(1).toLong)
      //搜索关键字 用户统计
      case Some("Wireless_ver2Streaming") => WirelessStatVer2(args(1).toLong)
      //推送相关统计
      case Some("PushCallbackJob") => PushCallbackJob(args(1))
      case Some("UserClickAnalysis") => UserClickAnalysis()

      case _ => println("rhino pipeline no job to execute !!!!!!!")
    }
    jobs(Option[String](args.head))
    System.exit(0)
  }

}
